/* 全局样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f9;
    color: #333;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

/* 主容器 */
.container {
    background-color: #ffffff;
    padding: 25px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
}

h1, h2 {
    color: #2c3e50;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-top: 0;
}

/* 控制区域 */
.controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.controls label {
    font-weight: 500;
}

.controls input[type="text"] {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.controls input[type="text"]:focus {
    border-color: #3498db;
    outline: none;
}

.controls button {
    padding: 10px 20px;
    font-size: 16px;
    color: #fff;
    background-color: #3498db;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.controls button:hover {
    background-color: #2980b9;
}

.controls button.disconnect {
    background-color: #e74c3c;
}

.controls button.disconnect:hover {
    background-color: #c0392b;
}


/* 状态面板 */
.status-panel {
    margin-bottom: 20px;
    font-size: 1.1em;
}

#status-text {
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: bold;
    color: #fff;
}

.status-disconnected { background-color: #e74c3c; /* 红色 */ }
.status-connecting { background-color: #f39c12; /* 橙色 */ }
.status-connected { background-color: #2ecc71; /* 绿色 */ }


/* 日志面板 */
#events-log {
    background-color: #ecf0f1;
    border: 1px solid #dcdcdc;
    border-radius: 4px;
    height: 300px;
    overflow-y: auto;
    padding: 15px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.log-message {
    padding: 8px 0;
    border-bottom: 1px dashed #ccc;
    word-wrap: break-word;
}

.log-message:last-child {
    border-bottom: none;
}

.log-message .timestamp {
    color: #95a5a6;
    margin-right: 10px;
}

/* 特定事件类型的样式 */
.event-temperature { color: #c0392b; }
.event-humidity { color: #2980b9; }
.event-info { color: #27ae60; }
.event-error { color: #d35400; font-weight: bold; }